package servlet;

import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import service.GoodsService;

import java.io.IOException;
import java.io.PrintWriter;

@WebServlet(name = "goods_delete", urlPatterns = "/goods_delete")
public class GoodsDeleteServlet extends HttpServlet {
    private  GoodsService goodsService = new GoodsService();
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType("text/html;charset=UTF-8");
        PrintWriter pw = response.getWriter();
        int id = Integer.parseInt(request.getParameter("id"));
        System.out.println(id+"id====");
        boolean isDeleted =goodsService.delete(id);
//        System.out.println("isDeleted:" + isDeleted);
    }
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
